package Controllers;

import Impl.PlaceServiceImpl;
import Impl.TeacherServiceImpl;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

@Controller
public class PlaceDeleteController extends HttpServlet {
	private static final long serialVersionUID = 1L;
    PlaceServiceImpl placeService;
	 @RequestMapping(value = "/PlaceDelete", method = {RequestMethod.POST,RequestMethod.GET})
		@ResponseBody
		public JSONObject userRegister(HttpServletRequest request) throws Exception {
		 	ApplicationContext applicationContext=(ApplicationContext)request.getSession().getServletContext().getAttribute("ctx");
	        placeService=(PlaceServiceImpl)applicationContext.getBean("PlaceServiceImpl");
			JSONObject obj = new JSONObject();
			int placeid=Integer.parseInt(request.getParameter("placeid").replaceAll("'", "").replaceAll("\"",""));
			placeService.placedelete(placeid);
			obj.put("status", "OK");
			return obj;
		}

}
